home *** CD-ROM | disk | FTP | other *** search
/ Merciful 2 / Merciful - Disc 2.iso / software / d / devioustools21.dms / devioustools21.adf / utils / 002.lzx / rexx / finger.AMIRX < prev   
Text File  |  1978-01-22  |  3KB  |  102 lines

  1. /* finger.AMIRX -- AmiTCP finger script for AmIRC.
  2. \\ Original idea and script by:   Alexander "Handtuch" Sorg
  3. // Edited/updated/overhauled by:  Troy "Doogie" Davis (doogie@wsp1.wspice.com)
  4. \\ $VER: finger.AMIRX v1.2 (12.21.95)
  5. //
  6. \\ AmiTCP:bin/finger must exist for this script to work.
  7. // Put this script in PROGDIR:rexx/ and add it as an alias with the command:
  8. \\ "/alias finger /rx finger %p"
  9. //
  10. \\ History
  11. //
  12. \\ v1.0 (12.17.95)
  13. //   · First attempt.  (Fixed a few things in Alexander's original version.)
  14. \\
  15. // v1.1 (12.19.95)
  16. \\   · Added -w switch.
  17. //   · Fixed a serious problem that would cause temp files to accumulate in
  18. \\     T:
  19. //
  20. \\ v1.2 (12.21.95)
  21. //   · If userhost is not found in AmIRC's internal list of userhosts, the
  22. \\     script will perform a "userhost" command and wait three seconds for
  23. //     one to be returned.
  24. \\   · Added -v switch.
  25. //   · Added the way cool version string and history.
  26. \\
  27. // Usage: FINGER [-v] [-w] nick
  28. \\
  29. // The -v switch returns version information.
  30. \\ The -w switch redirects output to a CON: window instead of to AmIRC.
  31. */
  32.  
  33. parse arg args
  34. options results
  35.  
  36. if ~show('L','rexxsupport.library') then addlib('rexxsupport.library',0,-30,0)
  37.  
  38. if find(args,'-v') ~=0 then do
  39.    "ECHO P="d2c(27)"b«Version»"d2c(27)"b finger.AMIRX v1.2 (12.21.95) by Troy ""Doogie"" Davis (doogie@wsp1.wspice.com)."
  40.    exit
  41. end
  42.  
  43. if args = "" | args = "-w" then do
  44.    "echo P="d2c(27)"b«Error»"d2c(27)"b Usage: FINGER [-v] [-w] nick"
  45.    exit
  46. end
  47.  
  48. if find(args,'-w') ~= 0 then do
  49.    pos = find(args,'-w')
  50.    nick = delword(args,pos,1)
  51.    nick = trim(nick)
  52.    win = "yes"
  53. end
  54. else do
  55.    win = "no"
  56.    nick = trim(args)
  57. end
  58.  
  59. userhost nick
  60. nickhost = result
  61. if nickhost = "RESULT" then do
  62.    "raw userhost :"nick
  63.    delay(150)
  64.    userhost nick
  65.    nickhost = result
  66.    if nickhost = "RESULT" then do
  67.       "echo P="d2c(27)"b«Error»"d2c(27)"b Could not obtain userhost for the nick """nick""".  Finger failed."
  68.       exit
  69.    end
  70. end
  71.  
  72. "echo P="d2c(27)"b«Finger»"d2c(27)"b Launching finger on "d2c(2)nick d2c(2)"("nickhost")."
  73.  
  74. namevalid = 0
  75. count = 1
  76. do while namevalid = 0
  77.    filename = "T:FingTemp"||count
  78.    if exists(filename) then do
  79.        count = count + 1
  80.    end
  81.    else do
  82.        namevalid = 1
  83.    end
  84. end
  85.  
  86. address command 'AmiTCP:bin/Finger >' filename nickhost
  87.  
  88. if win = "no" then do
  89.    call open(1,filename,r)
  90.    do until eof(1)
  91.       text=readln(1)
  92.       'echo P='d2c(27)'b«Finger»'d2c(27)'b "'text '"'
  93.    end
  94.    call close(1)
  95. end
  96. else do
  97.    address command 'type >"CON:0/0/640/250/Finger info for:  'nick' ('nickhost')/WAIT/CLOSE"' filename
  98. end
  99.  
  100. "echo P="d2c(27)"b«Finger»"d2c(27)"b End of FINGER output."
  101. delete(filename)
  102.